using System;
using bitzhuwei.Compiler;

namespace bitzhuwei.GLSLFormat {
    /// <summary>
    /// Correspond to the Vn node selection_statement in the grammar(GLSL).
    /// </summary>
    internal partial class Vnselection_statement : IFullFormat {
        // [323] selection_statement = 'if' '(' expression ')' selection_rest_statement ;



        private readonly TokenRange _scope;
        public TokenRange Scope => _scope;
        public void FullFormat(BlankConfig? preConfig, TextWriter writer, FormatContext context) {
            var config = new BlankConfig();
            context.PrintBlanksAnd(this.r4, preConfig, writer);
            context.PrintCommentsBetween(this.r4, this.r3, config, writer);
            context.PrintBlanksAnd(this.r3, config, writer);
            context.PrintCommentsBetween(this.r3, this.r2, config, writer);
            context.PrintBlanksAnd(this.r2, config, writer);
            context.PrintCommentsBetween(this.r2, this.r1, config, writer);
            context.PrintBlanksAnd(this.r1, config, writer);
            context.PrintCommentsBetween(this.r1, this.r0, config, writer);
            context.PrintBlanksAnd(this.r0, config, writer);
        }


        public readonly Token r4;
        public readonly Token r3;
        public readonly Vnexpression r2;
        public readonly Token r1;
        public readonly Vnselection_rest_statement r0;
        public Vnselection_statement(Token r4, Token r3, Vnexpression r2, Token r1, Vnselection_rest_statement r0) {
            this.r4 = r4;
            this.r3 = r3;
            this.r2 = r2;
            this.r1 = r1;
            this.r0 = r0;
            this._scope = new TokenRange(r4, r0);
        }


    }
}
